﻿<UserControl x:Class="WikiUploader.Controls.WikiEditorView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:avalon="clr-namespace:ICSharpCode.AvalonEdit;assembly=ICSharpCode.AvalonEdit"
             mc:Ignorable="d" 
             FontFamily="Tahoma"
             d:DesignHeight="300" d:DesignWidth="300">

   <!--UserControl.Resources>
      <HierarchicalDataTemplate DataType="{x:Type DotNetWikiBot:WikiPageList}"
                                ItemsSource="{Binding Path=Pages}">
         <TextBlock Text="{Binding Path=ListName}" />
      </HierarchicalDataTemplate>
      <HierarchicalDataTemplate DataType="{x:Type DotNetWikiBot:WikiPage}">
         <TextBlock Text="{Binding Path=Title}" />
      </HierarchicalDataTemplate>
   </UserControl.Resources-->
   
    <Grid>
      <Grid.RowDefinitions>
         <RowDefinition Height="Auto" />
         <RowDefinition Height="Auto" />
         <RowDefinition Height="*" />
         <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>

      <StackPanel Orientation="Horizontal"
                  Grid.Row="0">
         <TextBlock Grid.Row="0"
                    FontSize="18"
                    FontWeight="Bold"
                    Text="{Binding Path=Page.Title}" />
         <TextBlock Grid.Row="0"
                    Grid.Column="2"
                    VerticalAlignment="Bottom"
                    Margin="5,0,5,0"
                    FontSize="10"
                    Text="Page ID:" />
         <TextBlock Grid.Row="0"
                    Grid.Column="3"
                    FontSize="10"
                    VerticalAlignment="Bottom"
                    Text="{Binding Path=Page.PageId}" />
      </StackPanel>

      <Grid Grid.Row="1">
         <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
         </Grid.RowDefinitions>
         <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="0.5*" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="0.5*" />
         </Grid.ColumnDefinitions>

         <TextBlock Grid.Row="0"
                    Grid.Column="0"
                    Text="Last Editor:" />
         <TextBlock Grid.Row="0"
                    Grid.Column="1"
                    Text="{Binding Path=Page.LastUser}" />

         <TextBlock Grid.Row="0"
                    Grid.Column="2"
                    Text="Time Stamp:" />
         <TextBlock Grid.Row="0"
                    Grid.Column="3"
                    Text="{Binding Path=Page.LastTimestamp}" />

         <TextBlock Grid.Row="1"
                    Grid.Column="0"
                    Text="Comment:" />
         <TextBlock Grid.Row="1"
                    Grid.Column="1"
                    Grid.ColumnSpan="3"
                    Text="{Binding Path=Page.LastComment}" />
      </Grid>

      <Grid Grid.Row="2">
         <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.7*" />
            <ColumnDefinition Width="3px" />
            <ColumnDefinition Width="0.3*" />
         </Grid.ColumnDefinitions>
         <!--<TextBox Grid.Column="0"
                  TextWrapping="Wrap"
                  FontFamily="Consolas"
                  Text="{Binding Path=Page.Content}" />-->

         <avalon:TextEditor Grid.Column="0"
                            Name="_Editor"
                            ShowLineNumbers="True"
                            WordWrap="True" />

         <TreeView Grid.Column="2"
                   ItemsSource="{Binding Path=PageData}" />

         <GridSplitter Grid.Column="1"
                       HorizontalAlignment="Stretch"
                       VerticalAlignment="Stretch"
                       Width="3" />
      </Grid>
       
      <Grid Grid.Row="3"
            Margin="10,5,10,5">
         <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="75px" />
            <ColumnDefinition Width="25px" />
            <ColumnDefinition Width="75px" />
         </Grid.ColumnDefinitions>
         
         <Button Content="Reload"
                 Grid.Column="1"
                 Command="{Binding Path=LoadCommand}"  />
         
         <Button Content="Save"
                 Grid.Column="3"
                 Command="{Binding Path=SaveCommand}" />
      </Grid>
   </Grid>
</UserControl>
